<?php
abstract class Employee
{
    protected $name;
    private static $types = [
        'minion','cluedup','wellconnected'
    ];

    static function recruit($name)
    {
        $num = rand(1,count(self::$types)) - 1;
        $class = self::$types[$num];
        return new $class($name);
    }

    function __construct($name)
    {
        $this->name = $name;
    }

    abstract function fire();
}

class WellConnected extends Employee {
    function fire()
    {
        print "{$this->name}: I'll call my dad \n";
    }
}

class Minion extends Employee
{
    function fire()
    {
        print "{$this->name}:I'll clean my desk \n";
    }
}

class Cluedup extends Employee
{
    function fire()
    {
        print "{$this->name}:I'll call my lawyer\n";
    }
}

class NastyBoss{
    private $employee = [];
    function addEmployee(Employee $employee) {
        $this->employee[] = $employee;
    }

    function projectFail()
    {
        if(count($this->employee)) {
            $emp = array_pop($this->employee);
            $emp->fire();
        }
    }
}

$boss = new NastyBoss();
$boss->addEmployee(Employee::recruit('xu'));
$boss->addEmployee(Employee::recruit('shi'));
$boss->addEmployee(Employee::recruit('huan'));

$boss->projectFail();
$boss->projectFail();
$boss->projectFail();